import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '../views/Main.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/Main',
    name: 'Main',
    meta: {
      requireAuth: true
    },
    component: Main,
    children:[
      {
        path: '/home',
        name:'home',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/home')
      },
      {
        path: '/user',
        name:'user',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/User')
      },
      {
        path: '/mall',
        name: 'mall',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/Mall')
      },
      {
        path: '/ordera',
        name: 'ordera',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/order')
      },
      {
        path: '/logistic',
        name: 'logistic',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/logistic')
      },
      {
        path: '/coupan',
        name: 'coupan',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/coupan')
      },
      {
        path: '/money',
        name: 'money',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/money')
      },
      {
        path: '/refund',
        name: 'refund',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/refund')
      },
      {
        path: '/test',
        name: 'test',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/test')
      },
      {
        path: '/shop',
        name: 'shop',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/shop')
      },
      {
        path: '/testshop',
        name: 'testshop',
        meta: {
          requireAuth: true
        },
        component: () => import('../views/testshop')
      },
      // {
      //   path: '/page',
      //   name: 'page',
      //   meta: {
      //     requireAuth: true
      //   },
      //   component: () => import('../views/page1')
      // },
    ]
  },
  {
  path: '/login',
  name: 'login',
  component: () => import('../views/login/index.vue')
  },
  {
    path: '/',
    redirect: '/login'
  },
 
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router
